package com.gexiaobao.pigeon.ui.adapter

import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.GoodsTypeParentResponse
import com.gexiaobao.pigeon.app.util.ImageLoaderManager
import com.gexiaobao.pigeon.databinding.ItemFatherTypeBinding

/**
 * @Author      : hxw
 * @Date        : 2024/1/23 8:56
 * @Describe    :
 */
class FatherTypeAdapter(data: ArrayList<GoodsTypeParentResponse.ListBean>) :
    BaseQuickAdapter<GoodsTypeParentResponse.ListBean, DataBindBaseViewHolder>(R.layout.item_father_type, data) {

    override fun convert(holder: DataBindBaseViewHolder, item: GoodsTypeParentResponse.ListBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemFatherTypeBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        val imageGoodsIcon = holder.getView<AppCompatImageView>(R.id.imageviewItemType)
        ImageLoaderManager.loadRoundImageOrEmpty(context, item.img, imageGoodsIcon, 15, R.drawable.shop_product_def)
    }
}